<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2016/9/5
 * Time: 9:13
 */
namespace Home\Controller;
use Think\Controller;
class AssetsController extends Controller {
    public function __construct(){
        parent::__construct();
        $this->token = isset($_GET['token']) ? $_GET['token'] : 'dvaglg1469847559';
        if(!session('uid')){
            $this->redirect('Index/login');
        }
    }

    //首页
    public function index(){
        $this->display();
    }

    //问卷调查第一题
    public function investigation_index(){
        $type = M('AssetsUser')->where(array('id' => session('uid')))->getField('type');
        if ($type == 1) {
            $investigation_id = 1;
        } else {
            $investigation_id = 22;
        }
        $data = M('AssetsInvestigation')->where(array('id' => $investigation_id))->find();
        $this->assign('data',$data);
        $this->assign('type',$type);
        $this->display();

    }

    //问卷调查
    public function investigation(){
        $userinfo = M('AssetsUser')->where(array('id' => session('uid')))->find();
        $data = M('AssetsInvestigation')->where(array('type' => $userinfo['type'],'id' => array('not in','1,22')))->select();
        $this->assign('data',$data);
        $this->assign('userinfo',json_encode($userinfo,JSON_UNESCAPED_UNICODE));
//        dump($userinfo);
        $this->assign('type',$userinfo['type']);
        $this->display();
    }

    //问卷提交成功后
    public function after_submit(){
        $result = M('AssetsUser')->where(array('id' => session('uid')))->setField('isinvestigation',1);
        if($result){
            $data['status'] = 1;
            $data['msg'] = '成功！';
        }else{
            $data['status'] = 0;
            $data['msg'] = '失败！';
        }
        $this->ajaxReturn($data);
    }

    //投资理念
    public function invesment_philosophy(){
        $this->display();
    }

    //风控体系
    public function risk_control_system(){
        $this->display();
    }

    //公司简介
    public function company_introduction(){
        $this->display();
    }

    //产品中心
    public function product_center(){
        $this->display();

    }

    //购买流程
    public function the_buying_process(){
        $this->display();
    }

    //联系我们
    public function contact_us(){
        $this->display();
    }

    //行业动态
    public function industry_dy(){
        $this->display();
    }

    //新闻
    public function news_det(){
        $this->display();
    }

    //空操作
    public function _empty(){
        header('Location: /404.html');
    }
}